<%@ page language="java" %>
<%@ page session="true" %>
<%@ page import="java.sql.*,java.io.*,java.util.Random,com.jobportal.MyFunctions"%>
<HEAD>
	<LINK href="styles.css" type="text/css" rel="stylesheet">
	<script LANGUAGE="Javascript" SRC="Images/validate.js"></script>
</HEAD>
<BODY class=Grad>
<h3 align=center>Upload data</h3>
<%
	Connection con;
	ResultSet rs=null;
	Statement stmt=null;
	String UploadID = "";//request.getParameter("UploadID");	
	UploadID = MyFunctions.genNextID("Uploads","UploadID","U");
	String userid = (String)session.getAttribute("userr");
	String Title = request.getParameter("Title");	
	String sDate = request.getParameter("Date");
	String Category = request.getParameter("SelCategory");	
	String Description = request.getParameter("Description");	
	String Contributer = request.getParameter("Contributor");	
	String FilePath = request.getParameter("FilePath");	
	String FileName = FilePath.substring(FilePath.lastIndexOf("\\"),FilePath.length());
	try{
			
			/* Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			con = DriverManager.getConnection("jdbc:odbc:jobportal","root",""); */
			
			Class.forName("com.mysql.jdbc.Driver");
			con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jobmiller","root","root");

			stmt =  con.createStatement();
			String Query = "Insert into uploads values('"+UploadID+"','"+userid+"','"+Title+"','"+sDate+"','"+Category+"','"+Description+"','"+Contributer+"','"+FileName+"')";
			int result = stmt.executeUpdate(Query);
			if( result > 0)	{
				%><BR><BR><BR><BR>
					<h3 align=center>File uploaded successfully</h3>
				<%
			}
			else{
				%>
					<h3 align=center>Error: Please try again</h3>
					<CENTER><A HREF="Uploads0.jsp">Back</A></CENTER>
				<% 
			}
		stmt.close();
		con.close();
		}catch(Exception e){%><%=e%><%}
	
%>
</BODY>

</PRE>